Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move image pull args into struct #2891

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sondavidb
Copy link
Contributor

@sondavidb sondavidb commented Mar 22, 2024

In the image pull workflow, the function headers are getting far too large. (imgutil.EnsureImage had 13 required arguments as of the time of this PR.) This change consolidates many of the arguments in imgutil.PullImage into types.ImagePullTypes, and the necessary refactors that come with this change.

I did as much pre-processing in processPullCommandFlags as possible. So, anything that cannot be declared from the function flags did not fall in the options.

Did some basic testing with make and running some basic image commands to do a sanity check that functionality remained intact.

Very open to suggestions on how to structure this a bit more logically. I made a best effort but a fresh pair of eyes always helps 馃槄

pkg/imgutil/imgutil.go Outdated Show resolved Hide resolved
pkg/ipfs/image.go Outdated Show resolved Hide resolved
cmd/nerdctl/image_pull.go Outdated Show resolved Hide resolved
pkg/api/types/image_types.go Outdated Show resolved Hide resolved
@sondavidb sondavidb force-pushed the consolidate-image-pull-args branch 4 times, most recently from 77e11ab to cb5159c Compare March 29, 2024 23:14
@sondavidb
Copy link
Contributor Author

sondavidb commented Mar 29, 2024

Rebased with main and addressed reviews.

Wondering why lint check seems to fail though...

Copy link
Member

@djdongjin djdongjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one final comment. Thanks.

pkg/api/types/image_types.go Outdated Show resolved Hide resolved
@sondavidb sondavidb force-pushed the consolidate-image-pull-args branch from cb5159c to c7951ed Compare April 1, 2024 03:52
@sondavidb
Copy link
Contributor Author

Can I just confirm that the lint check failing is unrelated?

@djdongjin
Copy link
Member

Can I just confirm that the lint check failing is unrelated?

I think it's unrelated. You can rebase which should retrigger the CI.

@sondavidb sondavidb force-pushed the consolidate-image-pull-args branch from c7951ed to 02310d8 Compare April 4, 2024 21:02
@sondavidb
Copy link
Contributor Author

sondavidb commented Apr 4, 2024

Rebased

Rebase below this fixes lint issues

@sondavidb sondavidb force-pushed the consolidate-image-pull-args branch from 02310d8 to 6dd2f6c Compare April 4, 2024 21:08
@AkihiroSuda
Copy link
Member

Sorry, needs another rebase

Signed-off-by: David Son <davbson@amazon.com>
@sondavidb sondavidb force-pushed the consolidate-image-pull-args branch from 6dd2f6c to 947efe8 Compare May 21, 2024 17:16
@sondavidb
Copy link
Contributor Author

Rebased, but I think I would like to hold off on this PR for a bit. IMO, this needs to be part of a larger refactor. It would be strange to have all of the image args in a config for image pull, but not for any of the other commands.

If you'd still like this change feel free to merge, but I also think it would be good to do similar refactors for our other commands.

@djdongjin
Copy link
Member

I think it's okay to have this PR, given some methods like EnsureImage indeed has many args and having a config struct improve that a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants